﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Diagnostics;

namespace TouchExplorer.Controls
{
    /// <summary>
    /// Interaction logic for FilesTiles.xaml
    /// </summary>
    public partial class FilesTiles : Grid, IFileDisplay
    {
        private ExplorerViewModel Model
        {
            get
            {
                return DataContext as ExplorerViewModel;
            }
        }

        public FilesTiles()
        {            
            InitializeComponent();
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            var file = (((FrameworkElement)sender).DataContext) as TouchFile;
            if (file != null)
            {
                try
                {
                    Process.Start(file.FullPath);
                }
                catch (Exception)
                {
                    MessageBox.Show("Sorry, this file could not open properly");
                }
            }
        }

        public void Release()
        {
            
        }
    }
}
